function setRem() {
    var baseFontSize = 100;
    var baseWidth = 375;
    var clientWidth = document.documentElement.clientWidth || window.innerWidth || 375;
    var innerWidth = clientWidth;
    var rem = Math.floor(innerWidth / baseWidth * baseFontSize)
    if(innerWidth > 640) {
        rem = Math.floor(640 / baseWidth * baseFontSize)
    };
    console.log("setRem:", rem + "px");
    var dhtml = document.querySelector("html");
    dhtml.style.fontSize = rem + "px"
}
// 初始化
setRem();
// 改变窗口大小时重新设置 rem
window.onresize = function() {
    setRem()
}